﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntityBinder.Interface
{
	/// <summary>
	/// Interface which defines function needed by EntityReader.
	/// </summary>
	public interface IEntityReader
	{
		/// <summary>
		/// Method to read an object from the stream based on previous set rules.
		/// </summary>
		/// <param name="_inputStream">The input stream.</param>
		/// <returns>The object created by converting stream using rules.</returns>
		object Read(System.IO.Stream _inputStream);

		/// <summary>
		/// Method to read an object from the stream based on rules in parameter.
		/// </summary>
		/// <param name="_inputStream">The input stream.</param>
		/// <param name="_element">The rule to read the file.</param>
		/// <returns>The object created by the conversion of the stream using rule.</returns>
		object Read(System.IO.Stream _inputStream, IEntityElement _element);

		/// <summary>
		/// Method to read an object from the stream based on rules in parameter.
		/// </summary>
		/// <param name="_inputStream">The input stream.</param>
		/// <param name="_elements">The available rules to read the file.</param>
		/// <returns>The object created by the conversion of the stream using rules.</returns>
		object Read(System.IO.Stream _inputStream, IEnumerable<IEntityElement> _elements);

		/// <summary>
		/// Method to read an object from the stream based on previous set rules.
		/// </summary>
		/// <typeparam name="T">The type of the returned object.</typeparam>
		/// <param name="_inputStream">The input stream.</param>
		/// <returns>The object created by converting stream using rules.</returns>
		T Read<T>(System.IO.Stream _inputStream) where T : class;

		/// <summary>
		/// Method to read an object from the stream based on rules in parameter.
		/// </summary>
		/// <typeparam name="T">The type of the returned object.</typeparam>
		/// <param name="_inputStream">The input stream.</param>
		/// <param name="_element">The rule to read the file.</param>
		/// <returns>The object created by the conversion of the stream using rule.</returns>
		T Read<T>(System.IO.Stream _inputStream, IEntityElement _element) where T : class;

		/// <summary>
		/// Method to read an object from the stream based on rules in parameter.
		/// </summary>
		/// <typeparam name="T">The type of the returned object.</typeparam>
		/// <param name="_inputStream">The input stream.</param>
		/// <param name="_elements">The available rules to read the file.</param>
		/// <returns>The object created by the conversion of the stream using rules.</returns>
		T Read<T>(System.IO.Stream _inputStream, IEnumerable<IEntityElement> _elements) where T : class;
	}
}
